<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改卡密码</title>
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/layer/layer/mobile/need/layer.css}">
    <script th:src="@{/bootstrap/js/jquery.min.js}"></script>
    <script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/layer/layer/layer.js}"></script>
</head>
<body>
<div style="border: 1px solid grey;margin:70px;height: 500px">
    <h3 style="color: #1E9FFF;margin-left: 40%">八仙过海项目组出品</h3>
    <br>
    <br>
    <h3 style="color: #1E9FFF;margin-left: 46%">修改卡密码</h3>
    <div id="tbody" class="text-center">
        <form class="form-horizontal" role="form">
            <!--            <div class="form-group">-->
            <!--                <label  class="col-sm-4 control-label">卡号</label>-->
            <!--                <div class="col-sm-5">-->
            <!--                    <input hidden value="th:text='${cardnum}'" id="cardnum"/>-->
            <!--                </div>-->
            <!--            </div>-->
            <div class="form-group">
                <label class="col-sm-4 control-label">旧密码</label>
                <div class="col-sm-5">
                    <input type="password" class="form-control" id="oupwd"
                           placeholder="请输旧密码">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-4 control-label">新密码</label>
                <div class="col-sm-5">
                    <input type="password" class="form-control" id="nupwd"
                           placeholder="请输入新密码">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-4 control-label">再次输入新密码</label>
                <div class="col-sm-5">
                    <input type="password" class="form-control" id="nupwd2"
                           placeholder="请再次输入新密码">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-8">
                    <a href="/credit/test5" id="next2" class="btn-warning btn btn-lg">上一步</a>
                    <button type="button" th:onclick="next3()" id="next1" class="btn-success btn btn-lg">下一步</button>
                </div>
            </div>
        </form>
        <br>
        <br>
    </div>

</div>

</body>
<script th:inline="javascript">
    $("#nupwd2").keyup(function () {
        var nupwd=$("#nupwd").val();
        var nupwd2=$("#nupwd2").val();
        if(nupwd!=nupwd2){
            $("#nupwd2").css("border","1px solid red");
            $("#next1").attr("disabled",true);
        }else {
            $("#nupwd2").css("border","1px solid #ccc");
            $("#next1").attr("disabled",false);
        }
    })


    var ty1=[[${cardnum}]];
    function next3() {
        var s1=$("#nupwd").val();
        var s2=$("#nupwd2").val();
        var s3=$("#opwd").val();
        if(s1==""||s2==""||s3==""){
            layer.msg("密码不能为空");
        }else {
            $.post("/credit/updatePwd",
                "cardnum=" + ty1 +
                "&oupwd=" + $("#oupwd").val() +
                "&nupwd=" + $("#nupwd").val(), function (data) {
                    if (data.code == 200) {
                        layer.msg(data.message);
                    } else {
                        layer.msg(data.message);
                    }
                })
        }
    }
</script>
</html>